<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head th:replace="/common/include :: header(~{::title}, ~{::link}, ~{::style})">
	<title>日志监控-操作日志</title>
</head>
<body class="gray-bg">
    <div class="container-div">
		<div class="row">
			<th:block th:include="/common/breadcrumb :: breadcrumb"/>
			<div class="col-sm-12 search-collapse">
				<form id="search-form">
					<div class="select-list row">
						<div class="col-sm-3 col-xs-6">
							<div class="control-label">平台名称：</div>
							<div><input class="form-control" type="text" name="Q_applicationName_S_LK"/></div>
						</div>
						<div class="col-sm-3 col-xs-6">
							<div class="control-label">业务类型：</div>
							<div>
								<select class="form-control selectpicker" name="Q_businessType_S_EQ" th:with="type=${@dict.getDataGroup('sys_opera_type')}">
									<option value="">全部</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</div>
						</div>
						<div class="col-sm-3 col-xs-6">
							<div class="control-label">操作状态：</div>
							<div>
								<select class="form-control selectpicker" name="Q_status_S_EQ" th:with="type=${@dict.getDataGroup('sys_quartz_status')}">
									<option value="">全部</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</div>
						</div>
						<div class="col-sm-3 col-xs-6">
							<div class="control-label">操作时间：</div>
							<div class="select-time pull-right">
								<input class="form-control" type="text" id="startTime" placeholder="开始时间" name="Q_operaTime_D_GE"/>
								<span>-</span>
								<input class="form-control" type="text" id="endTime" placeholder="结束时间" name="Q_operaTime_D_LE"/>
							</div>
						</div>
						<div class="col-sm-3 col-xs-6">
							<div class="control-label">模块标题：</div>
							<div><input class="form-control" type="text" name="Q_moduleName_S_LK"/></div>
						</div>
						<div class="right-btn">
							<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search('bootstrap-table', 'search-form')"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-default btn-rounded btn-sm" onclick="$.form.reset('search-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</div>
					</div>
				</form>
			</div>

            <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-danger btn-del disabled" onclick="del()">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="delAll()">
					<i class="fa fa-remove"></i> 清空
				</a>
	        </div>

			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
	    </div>
	</div>

	<div th:replace="/common/include :: footer"></div>

	<script th:inline="javascript">
		var opera_type_list = [[${@dict.getDataGroup('sys_opera_type')}]];
		var status_data_list = [[${@dict.getDataGroup('sys_quartz_status')}]];
		var prefix = ctx + 'api/system/log';

		$(function() {
			// 加载日期组件
			$.form.renderDateRange('startTime', 'endTime');

            var options = {
                code: 'operaId',
                url: prefix + '/beanpost/table',
                sortName: 'operaTime',
                sortOrder: 'desc',
                search: false,
                showExport: false,
                pagination: true,
				rememberSelected: true,
                columns: [{
						field: 'rowState',
						checkbox: true
					},
					{
						field: 'applicationName',
						title: '平台名称',
						sortable: true
					},
                    {
                        field: 'moduleName',
                        title: '模块标题',
                        sortable: true
                    },
					{
						field: 'businessType',
						title: '业务类型',
						align: 'center',
						formatter: function(value, row, index) {
							return $.common.dictLabel(opera_type_list, value);
						}
					},
					{
						field: 'className',
						title: '请求模块',
						formatter: function(value, row, index) {
							return $.common.render.ellipsis(value);
						}
					},
                    {
                        field: 'methodName',
                        title: '请求方法',
						formatter: function(value, row, index) {
							return $.common.render.ellipsis(value);
						}
                    },
					{
						field: 'operaParam',
						title: '请求参数',
						formatter: function(value, row, index) {
							return $.common.render.ellipsis(value);
						}
					},
					{
						field: 'userName',
						title: '操作人员',
						formatter: function(value, row, index) {
							return $.common.render.ellipsis(value);
						}
					},
					{
						field: 'ip',
						title: '操作IP'
					},
					{
						field: 'city',
						title: '操作城市',
						formatter: function(value, row, index) {
							return $.common.render.ellipsis(value);
						}
					},
					{
						field: 'area',
						title: '操作地点',
						formatter: function(value, row, index) {
							return $.common.render.ellipsis(value);
						}
					},
					{
						field: 'status',
						title: '操作状态',
						align: 'center',
						formatter: function(value, row, index) {
							return $.common.dictLabel(status_data_list, value);
						}
					},
					{
						field: 'desc',
						title: '说明',
						formatter: function(value, row, index) {
							return $.common.render.ellipsis(value);
						}
					},
					{
						field: 'operaTime',
						title: '操作时间',
						sortable: true
					}]
            };
            $.table.init('bootstrap-table', options);
		});

		function del() {
            var url = prefix + '/beanpost/delete';
			$.operate.removeSelect('bootstrap-table', url, '确定删除选中的数据吗？', 'table', 'refresh');
		}

		function delAll() {
			var url = prefix + '/beanpost/delete';
			$.operate.remove(url, null, '确定删除全部数据吗？', 'refresh');
		}

		function refresh() {
		    $.table.refresh();
		}

	</script>
</body>
</html>